<template>
  <div class="header-box">
    <div>
      <i @click="toMain" class="el-icon-platform-eleme logo"></i>
    </div>
    <div class="header-img">
      <!-- 用户头像 -->
      <div @click="toMy">
        <el-avatar size="large" shape="square" :src="userInfo.img"></el-avatar>
      </div>
      <el-button class="img-btn" @click="toEdit" type="primary">创作</el-button>
    </div>
  </div>
</template>

<script>
import { mapState } from "vuex";
export default {
  computed: {
    ...mapState(["userInfo"]),
  },
  methods: {
    toMy() {
      this.$router.push("/my");
    },
    toMain() {
      this.$router.push('/main')
    },
    toEdit() {
      this.$router.push('/edit')
    }
  },
};
</script>

<style lang="scss" scoped>
.header-box {
  width: 100%;
  height: 70px;
  display: flex;
  border-bottom: 1px solid #ccc;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  .header-img {
    display: flex;
    align-items: center;
  }
  .img-btn {
    margin-left: 20px;
  }
}

.logo {
  font-size: 50px;

}
</style>